package com.scut.statistics_website.service;

import com.scut.statistics_website.config.GlobalVariables;
import com.scut.statistics_website.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Set;

@Component
public class RelationshipService {
    @Autowired
    private RedisUtil redisUtil;

    public ArrayList<String> getRelationships() {
        ArrayList<String> relationships = new ArrayList<>();
        Set<Object> rawRelationships = redisUtil.sGet(GlobalVariables.ALIVE_RELATIONSHIPS_SET_KEY);
        for(Object relationship : rawRelationships) {
            relationships.add((String)relationship);
        }
        return relationships;
    }
}
